{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "74422511",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.5.0rc1\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from mindspore import Tensor\n",
    "import mindspore.ops as ops\n",
    "import mindspore.context as context\n",
    "import mindspore as md\n",
    "\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "print(md.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a612b388",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character in identifier (Temp/ipykernel_14620/224402067.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"C:\\Users\\sjc\\AppData\\Local\\Temp/ipykernel_14620/224402067.py\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    context.set_context(device_target=“Ascend”)\u001b[0m\n\u001b[1;37m                                             ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character in identifier\n"
     ]
    }
   ],
   "source": [
    "\n",
    "context.set_context(device_target=“Ascend”)\n",
    "x = Tensor(np.ones([1,3,3,4]).astype(np.float32))\n",
    "y = Tensor(np.ones([1,3,3,4]).astype(np.float32))\n",
    "print(ops.add(x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ce499dfe",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 索引切片\n",
    "tensor[0]\n",
    "tensor[:,0]\n",
    "tensor[...,-1]\n",
    "\n",
    "#concat 连接\n",
    "\n",
    "#张量转换.asnumpy()\n",
    "#Tensor(name)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "mindspore1.5r",
   "language": "python",
   "name": "mindspore"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
